package testAndSomeTries.motionDetection;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;


public class Frame1 extends JFrame {
  JPanel contentPane;
  BorderLayout borderLayout1 = new BorderLayout();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  JScrollPane jScrollPane1 = new JScrollPane();
  JButton jButton1 = new JButton();
  JTextArea jTextArea1 = new JTextArea();
  TitledBorder titledBorder1;
  TitledBorder titledBorder2;
  FlowLayout flowLayout1 = new FlowLayout();
  FlowLayout flowLayout2 = new FlowLayout();

  /**Construct the frame*/
  public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  /**Component initialization*/
  private void jbInit() throws Exception  {
    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
    contentPane = (JPanel) this.getContentPane();
    titledBorder1 = new TitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153),2),"Videostream");
    titledBorder2 = new TitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153),2),"Systemout");
    contentPane.setLayout(borderLayout1);
    this.setSize(new Dimension(360, 450));
    this.setTitle("JMF - Snapshot");
    jButton1.setEnabled(false);
    jButton1.setAlignmentY((float) 1.0);
    jButton1.setText("Snapshot");
    jPanel1.setBorder(titledBorder1);
    jPanel1.setPreferredSize(new Dimension(350, 280));
    jPanel1.setLayout(flowLayout2);
    jPanel2.setPreferredSize(new Dimension(91, 35));
    jPanel2.setLayout(flowLayout1);
    jScrollPane1.setBorder(titledBorder2);
    jScrollPane1.setPreferredSize(new Dimension(3, 110));
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setLineWrap(true);
    jTextArea1.setBorder(null);
    jTextArea1.setAutoscrolls(false);
    jTextArea1.setEditable(false);
    jTextArea1.setFont(new java.awt.Font("Dialog", 0, 10));
    contentPane.add(jPanel2, BorderLayout.CENTER);
    jPanel2.add(jButton1, null);
    contentPane.add(jScrollPane1, BorderLayout.SOUTH);
    contentPane.add(jPanel1, BorderLayout.NORTH);
    jScrollPane1.getViewport().add(jTextArea1, null);
  }
  /**Overridden so we can exit when window is closed*/
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    	MotionDetectionOnVideo.player.close();
      System.exit(0);
    }
  }
}